package com.cvo.scrumtoolkit.client.RF;



import com.cvo.scrumtoolkit.shared.ScrumtoolRequestFactory;
import com.google.gwt.core.client.GWT;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;

/** This singelton-like implementation keeps an instance of the requestFactory
 * 
 * @author stijn
 *
 */
public class ScrumtoolRF {

	static ScrumtoolRequestFactory requestFactory;
	
	public static ScrumtoolRequestFactory get(){
		if(requestFactory==null){
			//EventBus was part of the tutorial.
			//I actually do not know why it is used for (probably to handle events :) ), and/or what you can do with it.
			//To be investigated.
			EventBus eventBus = new SimpleEventBus();
			requestFactory  = GWT.create(ScrumtoolRequestFactory.class);
			requestFactory.initialize(eventBus);		
		}
		return requestFactory;
	} 	
}
